<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>

        <title>Create Article</title>
    </h:head>
    <h:body>
        <h:form id="articleFormCreation" prependId="false">
            <h:messages/>

            <h:selectOneRadio id="status" value="#{articleBean.selectedArticle.status}"
                              title="Please choose a status" layout="pageDirection" border="1">
                <f:selectItem id="st1"   itemLabel="Draft" itemValue="Draft" />
                <f:selectItem id="st2"  itemLabel="Published" itemValue="Published" />
            </h:selectOneRadio>
            <hr></hr>
            <h:message for="date"/>
            <h:outputLabel for="title" value="Article Title(*):"/>
            <h:inputText value="#{articleBean.selectedArticle.title}" id="title" required="true"/>
            <h:message for="title"/>
            <hr></hr>
            <p:editor value="#{articleBean.selectedArticle.articleBody}" width="600"/>  
            <h:outputLabel for="articleTag" value="Tag(*):"/>
            <h:inputText value="#{articleBean.selectedArticle.tag}" id="articleTag" required="true"   />                        
            <h:message for="articleBody"/>
            <hr></hr>
            <h:outputLabel for="date" value="Publication Date:"/>
            <h:inputText value="#{articleBean.selectedArticle.date}" id="date">
                <f:convertDateTime pattern="dd/MM/yyyy"/>
            </h:inputText>  
            <br></br>
            <h:commandButton value="Save Article" action="#{articleBean.persistArticle()}"></h:commandButton>
            <h:commandButton value="Cancel" immediate="true" action="showRegMenu"></h:commandButton>
        </h:form>
    </h:body>
</html>
